/**
 * 
 */
package rachauto.presentation.controllers;

import java.io.Serializable;

import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;
import javax.inject.Named;

import rachauto.dto.UserDto;
import rachauto.presentation.common.utils.NavigationLogicHandler;

/**
 * @author said
 *
 */
@SuppressWarnings("serial")
@ManagedBean
@SessionScoped
public class UserController implements Serializable{

	private UserDto user;
	
	private boolean userLogedIn;
	
	public UserController(){
		super();
		user = new UserDto();
	}
	
	public String logoutAction(){
		NavigationLogicHandler.clearSession();
		this.userLogedIn = false;
		return "success";
	}
	
	public String loginAction(){
		try {
			Thread.sleep(1500);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		userLogedIn = true;
		return  "success"; 
	}
	

	/**
	 * @return the user
	 */
	public UserDto getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(UserDto user) {
		this.user = user;
	}

	/**
	 * @return the userLogedIn
	 */
	public boolean isUserLogedIn() {
		return userLogedIn;
	}

	/**
	 * @param userLogedIn the userLogedIn to set
	 */
	public void setUserLogedIn(boolean userLogedIn) {
		this.userLogedIn = userLogedIn;
	}
	
}
